//
//  CUIManager.cpp
//  beast_tamer
//
//  Created by chiawei.tseng on 13/2/19.
//
//

#include "CUIManager.h"
#include "CBaseUI.h"

CUIManager::CUIManager()
{
    
}

CUIManager::~CUIManager()
{
    UnRegisterUI();
}

void CUIManager::Init()
{
    
}

void CUIManager::Update()
{
    
    UIitr pi = m_UIs.begin();
    
    while (pi != m_UIs.end())
    {
        (*pi)->update();
        
        pi++;
    }
}

void CUIManager::RegisterUI(CBaseUI* ptrUI)
{
    m_UIs.push_back(ptrUI);
    
    ptrUI->retain();
}

void CUIManager::UnRegisterUI()
{
    UIitr pi = m_UIs.begin();
    
    while (pi != m_UIs.end())
    {
        (*pi)->release();
        
        pi = m_UIs.erase(pi);
    }
}